package com.mmy.dao.ship;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.mmy.domain.ship.VShipOrder;

public interface VShipOrderRepository extends JpaRepository<VShipOrder, Integer> {

	/*
	 * 根据出纳审核状态查找
	 */
	@Query(value = "select *  from vShipOrder where iCashierState = :strCashierState and left (cOrderID,6) = :iShipID", nativeQuery = true)
	List<VShipOrder> findByCashierAndShipID(@Param("strCashierState") String strCashierState,
			@Param("iShipID") int iShipID);

	/*
	 * 根据会计审核状态查找
	 */
	@Query(value = "select *  from vShipOrder where iAccountState = :strAccountState and left (cOrderID,6) = :iShipID", nativeQuery = true)
	List<VShipOrder> findByAccountAndShipID(@Param("strAccountState") String strAccountState,
			@Param("iShipID") int iShipID);

	/*
	 * 根据ID查找
	 */
	@Query(value = "select *  from vShipOrder where left (cOrderID,6) = :iShipID", nativeQuery = true)
	List<VShipOrder> findByShipID(@Param("iShipID") int iShipID);

}
